/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ihmprojet.core.model.operateur;

/**
 *
 * @author thomas
 * @author Rémi PIOTAIX <remi.piotaix@gmail.com>
 */
public class OperateurUnaire extends Operateur {

    public enum TypeUnaire {

        Iteratif, Optionnel, Connection;
    }
    private TypeUnaire type = TypeUnaire.Connection;

    public OperateurUnaire() {
    }

    public OperateurUnaire(TypeUnaire t) {
        this.type = t;
    }

    public OperateurUnaire(OperateurUnaire operateur) {
        this.type = operateur.getType();
    }

    public TypeUnaire getType() {
        return type;
    }

    public void setType(TypeUnaire type) {
        this.type = type;
    }

    public String decorate(String s) {
        switch (this.type) {
            case Iteratif:
                return s + "*";
            case Optionnel:
                return "[" + s + "]";
            case Connection:
                return "-" + s + "-";
        }
        return s;
    }
}
